<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<script>
$(function(){
	$("#commentsIndexStateSelectId").val("${viewRequest.params['_and_c_dot_state_eq_number']}");
	$("#commentsIndexMemberName").val("${memberName}");
	$("#commentsIndexGoodsName").val("${goodsName}");
});

</script>

<form id="pagerForm" method="get" model="viewRequest" action="#rel#">
	<input type="hidden" name="viewRequest.page" value="${page.number}" />
	<input type="hidden" name="viewRequest.size" value="${page.size}" />
	<c:forEach items="${viewRequest.params}" var="params">
		<input type="hidden" id="${params.key}" name="viewRequest.params['${params.key}']" value="${params.value}" />
	</c:forEach>
	<c:forEach items="${viewRequest.sort}" var="sort">
		<input type="hidden" name="viewRequest.sort.${sort.key}" value="${sort.value}" />
	</c:forEach>
</form>

<div class="pageHeader">
	<form rel="pagerForm" onsubmit="return comments_navSearch(this);" action="${rootUrl}/order/comments" method="get">
	<div class="searchBar">
		<ul class="searchContent" style="height: 50px">
			<li>
				<label>商品名称：</label>
				<input type="hidden" id="commentsIndexGoodsId" name="goods.id"/>
				<input type="text" id="commentsIndexGoodsName" name="goods.name" style="float:left"/>
				<a class="btnLook" href="${rootUrl}/goods/goods/1/dialog" width="800" height="720" lookupGroup="goods">会员</a>
			</li>
			
			<li>
				<label>分数：</label>
				<input type="text" name="viewRequest.params['_and_c_dot_scores_eq_number']" value="${viewRequest.params['_and_c_dot_scores_eq_number'] }"/>
			</li>
			<li>
				<label>内容：</label>
				<input type="text" name="viewRequest.params['_and_c_dot_content_like']" value="${viewRequest.params['_and_c_dot_content_like']}"/>
			</li>
			<li style="width: 400px">
				<label>评论时间：</label>
				<input name="viewRequest.params['_and_c_dot_addtime_ge_date']" type="text" class="date" size="20" value="${viewRequest.params['_and_c_dot_addtime_ge_date'] }" placeholder="开始时间"/>
				<input name="viewRequest.params['_and_c_dot_addtime_le_date']" type="text" class="date" size="20" value="${viewRequest.params['_and_c_dot_addtime_le_date'] }" placeholder="结束时间"/>
			</li>
			<li>
				<label>状态：</label>
				<select id="commentsIndexStateSelectId" name="viewRequest.params['_and_c_dot_state_eq_number']">
						<option value="">全部</option>				
						<option value="0">审核中</option>				
						<option value="1">审核通过</option>				
						<option value="2">审核不通过</option>				
				</select>
			</li>
		</ul>
		<div class="subBar">
			<ul>
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit">检索</button></div></div></li>
			</ul>
		</div>
	</div>
	</form>
</div>
<div class="pageContent">
	<table class="table" targetType="dialog"  width="100%" layoutH="135">
		<thead>
			<tr>
				<th width="30" align="center" >序号</th>
				<th width="120">商品名称</th>
				<th width="120">会员名称</th>
				<th width="30">分数</th>
				<th width="200">内容</th>
				<th width="100">评论时间</th>
				<th width="40">状态</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.content}" var="comment" varStatus="status">
				<td>${status.count}</td>
				<td>${comment.goodsName}</td>
				<td>${comment.member.name }</td>
				<td>${comment.scores}</td>
				<td>${comment.content }</td>
				<td><fmt:formatDate value="${comment.addtime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
				<td><c:if test="${comment.state ==0}">待审核</c:if><c:if test="${comment.state ==1}">审核通过</c:if><c:if test="${comment.state ==2}">审核不通过</c:if></td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="panelBar">
		<div class="pages">
			<span>显示</span>
			<select class="combox" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value})">
				<option value="${page.size}">${page.size}</option>
				<option value="20">20</option>
				<option value="50">50</option>
				<option value="100">100</option>
				<option value="200">200</option>
			</select>
			<span>条，共${page.totalElements}条 </span>
		</div>
		<div class="pagination" targetType="dialog" totalCount="${page.totalElements}" numPerPage="${page.size}" pageNumShown="10" currentPage="${page.number}"></div>
	</div>
</div>

<script>
	function comments_navSearch(obj){
		$("#commentsIndexMemberId").attr("name","viewRequest.params['_and_m_dot_id_eq_number']");
		$("#commentsIndexMemberName").attr("name","memberName");
		
		$("#commentsIndexGoodsId").attr("name","viewRequest.params['_and_g_dot_id_eq_number']");
		$("#commentsIndexGoodsName").attr("name","goodsName");
		
		return navTabSearch(obj);
	}
</script>